package cn.maidouya.user.intercepter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *  拦截器的配置类
 */
//@Configuration
public class WebConfigurer implements WebMvcConfigurer {
    @Autowired
    private LoginIntercepter loginIntercepter;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 交给spring管理   .addPathPatterns("/**")拦截所有    excludePathPatterns("/login/**")放行位置
        registry.addInterceptor(loginIntercepter)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/user/register/**")
                .excludePathPatterns("/fastDfs")
                .excludePathPatterns("/shop/settlement")
                .excludePathPatterns("/verifycode/**");
    }
}